Skip to content

Fix HTML/JS/CSS issues in Broadcast Registry Mermaid template#17

Merged
nevstop merged 8 commits into
mainfrom
copilot/review-html-js-css-code
Apr 27, 2026
Merged

Fix HTML/JS/CSS issues in Broadcast Registry Mermaid template#17
nevstop merged 8 commits into
mainfrom
copilot/review-html-js-css-code

Conversation

Copilot AI commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Code review of src/_support/html/Broadcast Registry Mermaid.html surfaced several standards, correctness, and UX issues in the viewer template. Each fix lands as its own commit for easy review.

HTML structure

  • Add <!DOCTYPE html>, lang="zh", and a <title> so the page renders in standards mode and is properly identified by browsers/AT.

JavaScript

  • Drop the deprecated navigator.userLanguage fallback in favor of navigator.language || 'en'.
  • Mark the wheel listener as { passive: false } so preventDefault() is honored without the Chrome intervention warning.
  • Round scale to one decimal per step to avoid accumulated float drift (e.g. 1.0000000000000002).
  • Clamp zoom on both ends via new scaleMax = 5 / scaleMin = 0.1 constants — previously only the lower bound was enforced.
  • Remove the second DOMContentLoaded handler whose setTimeout(..., 100) only re-applied scale(1) (a no-op) — fragile timing hack with no effect.
// before
scale += scaleStep;
// or
scale = Math.max(0.1, scale - scaleStep);

// after
scale = Math.round(Math.min(scaleMax, scale + scaleStep) * 10) / 10;
scale = Math.round(Math.max(scaleMin, scale - scaleStep) * 10) / 10;

CSS

  • Constrain .operation-tips with max-width: calc(100vw - 30px) and box-sizing: border-box so the fixed-position banner doesn't overflow narrow viewports (e.g. embedded LabVIEW WebView).

The %s Mermaid graph placeholder filled in by LabVIEW is left untouched.

Copilot AI and others added 7 commits April 27, 2026 05:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves the “Broadcast Registry Mermaid” HTML viewer template to render in standards mode, behave better during zoom interactions, and avoid UI overflow in narrow embedded webviews.

Changes:

  • Add HTML5 doctype, document language attribute, and a page title.
  • Refine zoom behavior: clamp scale min/max, round per step, and register the wheel handler as non-passive so preventDefault() is honored.
  • Constrain the fixed operation tips banner to prevent viewport overflow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/_support/html/Broadcast Registry Mermaid.html Outdated
@nevstop nevstop marked this pull request as ready for review April 27, 2026 06:00
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@nevstop nevstop merged commit d902351 into main Apr 27, 2026
2 of 4 checks passed
@nevstop nevstop deleted the copilot/review-html-js-css-code branch April 27, 2026 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants